/**
 * 用户列表 add by gsh
 */
$(function() {
	// 全选
	$("#chkAll").change(function() {
		var chkStatus = $(this).is(":checked");
		$("[id^=chk]:not(#chkAll)").each(function() {
			this.checked = chkStatus;
		});
	});

});

function getChecked() {
	var map = $("[id^=chk]:not(#chkAll)").map(function() {
		if (this.checked)
			return this.value;
	});
	return map.get();
}


//通过
function pass(askId) {
	var index = msgWnd.confirm("确认通过吗?", {
		title : "提现申请审核",
		skin : 'layui-layer-lan',
		btn : [ "确定", "取消" ],
		icon : 1
	}, function() {
		$.ajax({
			type : "POST",
			url : "/account/audit/cash/pass/"+askId,
			dataType : "json",
			success : function(msg) {
				if (msg.data.status == 1) {
					msgTools.alert("提现申请审核", "审核成功。", 1000);
					if(typeof(reloadPg)!="undefined")
						reloadPg();
					else
						window.location.href = window.location.href;
				}
			}
		});	
		msgWnd.close(index);
	});	
}

//拒绝
function refuseDlg(askId) {
	var index = msgWnd.open({
		title : "提现申请审核",
		skin : 'layui-layer-lan',
		type : 2,
		shade : 0.5,
		area : [ "510px", "420px" ],
		maxmin : true,
		content : '/account/audit/cash/refuse/msg/' + askId,
		zIndex : layer.zIndex
	});
}

//撤消
function cancel(askId) {
	var index = msgWnd.confirm("确认撤消吗?", {
		title : "撤消提现申请审核",
		skin : 'layui-layer-lan',
		btn : [ "确定", "取消" ],
		icon : 1
	}, function() {
		$.ajax({
			type : "POST",
			url : "/account/audit/cash/cancel/"+askId,
			dataType : "json",
			success : function(msg) {
				if (msg.data.status == 1) {
					msgTools.alert("提现申请审核", "审核成功。", 1000);
					if(typeof(reloadPg)!="undefined")
						reloadPg();
					else
						window.location.href = window.location.href;
				}
			}
		});	
		msgWnd.close(index);
	});	
}

//支付
function pay(askId) {
	var index = msgWnd.open({
		title : "确认打款",
		skin : 'layui-layer-lan',
		type : 2,
		shade : 0.5,
		area : [ "500px", "320px" ],
		maxmin : true,
		content : '/account/audit/cash/pay/msg/' + askId,
		zIndex : layer.zIndex
	});
}


function viewUser(id) {
	var index = msgWnd.open({
		title : "查看用户信息",
		skin : 'layui-layer-lan',
		type : 2,
		shade : 0.5,
		area : [ "510px", "550px" ],
		maxmin : true,
		content : '/user/view/' + id,
		zIndex : layer.zIndex
	});	
}

function selDateRange() {
	var index = msgWnd.open({
		title : "选择查询日期",
		skin : 'layui-layer-lan',
		type : 2,
		shade : 0.5,
		area : [ "510px", "220px" ],
		maxmin : true,
		content : '/views/pages/ddl/ddlDateRange.jsp',
		zIndex : layer.zIndex
	});	
	msgWnd.selectResultCallBack=function(val){
		$("#exportForm0").find("[name=createTime]").val(val.time1);
		$("#exportForm0").find("[name=createTime1]").val(val.time2);
		$('#exportForm0').submit();
	};
}

function selDateRange2() {
	var index = msgWnd.open({
		title : "选择查询日期",
		skin : 'layui-layer-lan',
		type : 2,
		shade : 0.5,
		area : [ "510px", "220px" ],
		maxmin : true,
		content : '/views/pages/ddl/ddlDateRange.jsp',
		zIndex : layer.zIndex
	});	
	msgWnd.selectResultCallBack=function(val){
		$("#exportForm1").find("[name=createTime1]").val(val.time2);
		$("#exportForm1").find("[name=createTime1]").val(val.time2);
		$('#exportForm1').submit();
	};	
}

function batchPay(){
	var idList=getChecked();
	if(idList!=null && idList.length>0)idList=idList.join("_");	
	else{
		msgTools.alert("错误", "请选择要操作的记录！", 1000);
		return;
	}	
	var idList=getChecked();
	if(idList!=null && idList.length>0)idList=idList.join("_");
	var index = msgWnd.open({
		title : "批量确认打款",
		skin : 'layui-layer-lan',
		type : 2,
		shade : 0.5,
		area : [ "500px", "320px" ],
		maxmin : true,
		content : '/account/audit/cash/pay/batch/msg/' + idList,
		zIndex : layer.zIndex
	});	
}

function exportDat0(){
	var el=$("#qryCond").html();
	var frm = $("#exportForm0").html(el);
	frm.hide();
	frm.submit();
}

/*function exportDat1(){
	var el=$("#qryCond").html();
	var frm = $("#exportForm1").html(el);
	frm.hide();
	frm.submit();
}*/